home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / PROGRAMR / OLE2BOOK.ZIP / CHAP05.ZIP / CHAP05 / SCHMOO / SCHMOO.H < prev    next >
C/C++ Source or Header  |  1993-04-13  |  4KB  |  173 lines

  1. /*
  2.  * SCHMOO.H
  3.  * Chapter 5 Modification
  4.  *
  5.  * Single include file that pulls in everything needed for other source
  6.  * files in the Schmoo application.
  7.  *
  8.  * Copyright (c)1993 Microsoft Corporation, All Rights Reserved
  9.  *
  10.  * Kraig Brockschmidt, Software Design Engineer
  11.  * Microsoft Systems Developer Relations
  12.  *
  13.  * Internet  :  kraigb@microsoft.com
  14.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  15.  */
  16.  
  17.  
  18. #ifndef _SCHMOO_H_
  19. #define _SCHMOO_H_
  20.  
  21. #include <windows.h>
  22. #include <memory.h>
  23. //CHAPTER5MOD
  24. #include <ole2.h>   //Required for storage use
  25. #include <ole2ver.h>
  26. #include <bookguid.h>
  27. //End CHAPTER5MOD
  28.  
  29. //These include files reference DLLs that don't have extern "C" already
  30. extern "C"
  31.     {
  32.     #include <commdlg.h>
  33.     }
  34.  
  35. #include <classlib.h>
  36. #include "resource.h"
  37.  
  38.  
  39. //Get the editor window information.
  40. #include "polyline.h"
  41.  
  42.  
  43.  
  44. //SCHMOO.CPP:  Frame object that creates a main window
  45.  
  46. class __far CSchmooFrame : public CFrame
  47.     {
  48.     private:
  49.         HBITMAP         m_hBmpLines[5];     //Menu item bitmaps
  50.         //CHAPTER5MOD
  51.         BOOL            m_fInitialized;     //Did CoInitalize work?
  52.         //EndCHAPTER5MOD
  53.  
  54.     protected:
  55.         //Overridable for creating a CClient for this frame
  56.         virtual LPCClient CreateCClient(void);
  57.  
  58.         virtual BOOL      FRegisterAllClasses(void);
  59.         virtual BOOL      FPreShowInit(void);
  60.         virtual UINT      CreateGizmos(void);
  61.  
  62.         virtual LRESULT   OnCommand(HWND, WPARAM, LPARAM);
  63.         virtual void      OnDocumentDataChange(LPCDocument);
  64.         virtual void      OnDocumentActivate(LPCDocument);
  65.  
  66.         //New for this class
  67.         virtual void      CreateLineMenu(void);
  68.  
  69.     public:
  70.         CSchmooFrame(HINSTANCE, HINSTANCE, LPSTR, int);
  71.         virtual ~CSchmooFrame(void);
  72.  
  73.         //Overrides
  74.         //CHAPTER5MOD
  75.         virtual BOOL      FInit(LPFRAMEINIT);
  76.         //End CHAPTER5MOD
  77.         virtual void      UpdateMenus(HMENU, UINT);
  78.         virtual void      UpdateGizmos(void);
  79.  
  80.         //New for this class
  81.         virtual void      CheckLineSelection(UINT);
  82.     };
  83.  
  84.  
  85. typedef CSchmooFrame FAR * LPCSchmooFrame;
  86.  
  87.  
  88.  
  89.  
  90.  
  91. //CLIENT.CPP
  92.  
  93. /*
  94.  * The only reason we have a derived class here is to override
  95.  * CreateCDocument so we can create our own type as well as
  96.  * overriding NewDocument to perform one other piece of work once the
  97.  * document's been created.
  98.  */
  99.  
  100. class __far CSchmooClient : public CClient
  101.     {
  102.     protected:
  103.         //Overridable for creating a new CDocument
  104.         virtual LPCDocument CreateCDocument();
  105.  
  106.     public:
  107.         CSchmooClient(HINSTANCE);
  108.         virtual ~CSchmooClient(void);
  109.  
  110.         virtual LPCDocument NewDocument(BOOL, LPCDocumentAdviseSink);
  111.     };
  112.  
  113.  
  114. typedef CSchmooClient FAR * LPCSchmooClient;
  115.  
  116.  
  117.  
  118.  
  119. //DOCUMENT.CPP
  120.  
  121. //Constant ID for the window polyline that lives in a document window
  122. #define ID_POLYLINE         10
  123.  
  124.  
  125. class __far CSchmooDoc : public CDocument
  126.     {
  127.     friend class CPolylineAdviseSink;
  128.  
  129.     protected:
  130.         UINT            m_uPrevSize;        //Last WM_SIZE wParam
  131.         LONG            m_lVer;             //Loaded Polyline version
  132.  
  133.         LPCPolyline             m_pPL;      //Polyline Editor window in us.
  134.         LPCPolylineAdviseSink   m_pPLAdv;   //Advises from Polyline
  135.  
  136.     protected:
  137.         virtual BOOL    FMessageHook(HWND, UINT, WPARAM, LPARAM, LRESULT FAR *);
  138.  
  139.     public:
  140.         CSchmooDoc(HINSTANCE);
  141.         virtual ~CSchmooDoc(void);
  142.  
  143.         virtual BOOL     FInit(LPDOCUMENTINIT);
  144.  
  145.         virtual void     Clear();
  146.  
  147.         virtual UINT     ULoad(BOOL, LPSTR);
  148.         virtual UINT     USave(UINT, LPSTR);
  149.  
  150.         virtual void     Undo(void);
  151.         virtual BOOL     FClip(HWND, BOOL);
  152.         virtual HGLOBAL  RenderFormat(UINT);
  153.         virtual BOOL     FQueryPaste(void);
  154.         virtual BOOL     FPaste(HWND);
  155.  
  156.         virtual COLORREF ColorSet(UINT, COLORREF);
  157.         virtual COLORREF ColorGet(UINT);
  158.  
  159.         virtual UINT     LineStyleSet(UINT);
  160.         virtual UINT     LineStyleGet();
  161.     };
  162.  
  163. typedef CSchmooDoc FAR * LPCSchmooDoc;
  164.  
  165.  
  166. //These color indices wrap the polyline definitions
  167. #define DOCCOLOR_BACKGROUND             POLYLINECOLOR_BACKGROUND
  168. #define DOCCOLOR_LINE                   POLYLINECOLOR_LINE
  169.  
  170.  
  171.  
  172. #endif //_SCHMOO_H_
  173.